package com.team.sion.controller;

import com.team.sion.common.SuccessMessage;
import com.team.sion.pojo.Comment;
import com.team.sion.pojo.Messages;
import com.team.sion.pojo.Song;
import com.team.sion.pojo.SongList;
import com.team.sion.service.CommentService;
import org.aspectj.bridge.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/comment")
public class CommentController {

    @Autowired
    private CommentService commentService;

    @RequestMapping("/add")
    public Object setComment(Comment comment){
        commentService.addComment(comment);
        return new SuccessMessage<>("success").getMessage();
    }

    @RequestMapping("/delete")
    public Object deleteComment(Integer id){
        commentService.deleteComment(id);
        return new SuccessMessage<>("delete").getMessage();
    }

    @RequestMapping("/like")
    public Object setSupport(Integer id,Integer up){
        commentService.setSupport(id,up);
        return new SuccessMessage<>("like").getMessage();
    }
    @RequestMapping("/songList/detail")
    public Object getAllSongListComment(Integer songListId){
        List<Comment> list = commentService.getAllSongListComment(songListId);
        return new SuccessMessage<>("请求成功",list).getMessage();
    }
    @RequestMapping("/song/detail")
    public Object getAllSongComment(Integer songId){
        List<Comment> list = commentService.getAllSongComment(songId);
        return new SuccessMessage<>("请求成功",list).getMessage();
    }
}
